package com.lsc.jdbc.demo.file.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class IoTest {


    /**
     * 在 I/O流当中  从在两种  Input   OutPut
     * @param args
     */
    public static void main(String[] args) {

        /* 输出流 OutPut */
        try {
            FileOutputStream fileOutputStream = new FileOutputStream("D:\\info.txt");

            /* 数组的定义   byte */
            byte[] info = {1, 2, 3, 4, 5, 6};
            fileOutputStream.write(info);
            fileOutputStream.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


        /* 输入流 Input */
        try {
            FileInputStream fileInputStream = new FileInputStream("D:\\info.txt");
            int available = fileInputStream.available();
            for (int i = 0; i < available; i++) {
                System.out.println(fileInputStream.read());
            }
            fileInputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
